//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;
using OpenLS.Drawing.Serialization;

namespace OpenLS.Drawing
{
    public class NonVisualDrawingShapeProps : IOfficeXmlSerializable
    {
        private ShapeLocking spLocks;
        private bool txBox;

        public bool TxBox
        {
            get { return txBox; }
            set { txBox = value; }
        }

        public ShapeLocking Locking
        {
            get { return spLocks; }
            set { spLocks = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.ReadAndSwitch("cNvSpPr", DrawingConstants.DrawingNamespaceUri, false))
            {
                TxBox = c.GetOptionalBoolean("txBox", false);
                Locking = c.ReadOptionalElement<ShapeLocking>("spLocks");
                c.WarnIf("ext");
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.WriteAndSwitch("cNvSpPr", DrawingConstants.DrawingNamespace))
            {
                c.SetOptionalBoolean("txBox", txBox, false);
                c.WriteOptionalElement(Locking);
                c.WarnIf("ext");
            }
        }

        #endregion
    }
}